﻿using System;
using System.Data;
using System.Text;
using System.Collections.Generic;
using Microsoft.Practices.EnterpriseLibrary.Data;
using Microsoft.Practices.EnterpriseLibrary.Data.Sql;
using System.Data.Common;

namespace Chenxin.Lib.House.DAL
{
	/// <summary>
	/// 数据访问类Customer_DemandInfo。
	/// </summary>
	public class Customer_DemandInfo
	{
        private const string CONNECTSTRING_SEARCH = "Chenxin_House_Search";
        private const string CONNECTSTRING = "Chenxin_House";

		public Customer_DemandInfo()
		{}
		#region  成员方法

		/// <summary>
		/// 是否存在该记录
		/// </summary>
		public static bool Exists(Guid DemandId)
		{
			Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING);
			StringBuilder strSql = new StringBuilder();
			strSql.Append("select count(1) from Customer_DemandInfo where DemandId=@DemandId ");
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "DemandId", DbType.Guid,DemandId);
			int cmdresult;
			object obj = db.ExecuteScalar(dbCommand);
			if ((Object.Equals(obj, null)) || (Object.Equals(obj, System.DBNull.Value)))
			{
				cmdresult = 0;
			}
			else
			{
				cmdresult = int.Parse(obj.ToString());
			}
			if (cmdresult == 0)
			{
				return false;
			}
			else
			{
				return true;
			}
		}


		/// <summary>
		/// 增加一条数据
		/// </summary>
        public static void Add(Chenxin.Lib.House.Entity.Customer_DemandInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("insert into Customer_DemandInfo(");
            strSql.Append("CityId,CityName,DemandId,CustomerId,CustomerCode,CustomerName,DemandKind,DemandType,DemandZone,TotalPrice,HouseUse,Consider,DemandArea,ServiceDemand,HouseBuyTime,DemandBuilding,SpecialDemand,DemandStyle_Room,DemandStyle_Hall,DemandStyle_Toilet,UnitPrice,CompanyId,CompanyName,Fitment,Remark,ServiceNum,Catalog,ReturnRate,Status,Addtime,Updatetime,AddPersonId,AddPerson,AddDepartId,AddDepart,OprPersonId,OprPerson,OprDepartId,OprDepart,LastTraceDay,Filter,PubLevel)");

			strSql.Append(" values (");
            strSql.Append("@CityId,@CityName,@DemandId,@CustomerId,@CustomerCode,@CustomerName,@DemandKind,@DemandType,@DemandZone,@TotalPrice,@HouseUse,@Consider,@DemandArea,@ServiceDemand,@HouseBuyTime,@DemandBuilding,@SpecialDemand,@DemandStyle_Room,@DemandStyle_Hall,@DemandStyle_Toilet,@UnitPrice,@CompanyId,@CompanyName,@Fitment,@Remark,@ServiceNum,@Catalog,@ReturnRate,@Status,@Addtime,@Updatetime,@AddPersonId,@AddPerson,@AddDepartId,@AddDepart,@OprPersonId,@OprPerson,@OprDepartId,@OprDepart,@LastTraceDay,@Filter,@PubLevel)");
			Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING);
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
            db.AddInParameter(dbCommand, "CityId", DbType.Guid, model.CityId);
            db.AddInParameter(dbCommand, "CityName", DbType.AnsiString, model.CityName);
			db.AddInParameter(dbCommand, "DemandId", DbType.Guid, model.DemandId);
			db.AddInParameter(dbCommand, "CustomerId", DbType.Guid, model.CustomerId);
			db.AddInParameter(dbCommand, "CustomerCode", DbType.AnsiString, model.CustomerCode);
			db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
			db.AddInParameter(dbCommand, "DemandKind", DbType.Int32, model.DemandKind);
			db.AddInParameter(dbCommand, "DemandType", DbType.Int32, model.DemandType);
			db.AddInParameter(dbCommand, "DemandZone", DbType.AnsiString, model.DemandZone);
			db.AddInParameter(dbCommand, "TotalPrice", DbType.AnsiString, model.TotalPrice);
			db.AddInParameter(dbCommand, "HouseUse", DbType.AnsiString, model.HouseUse);
			db.AddInParameter(dbCommand, "Consider", DbType.AnsiString, model.Consider);
			db.AddInParameter(dbCommand, "DemandArea", DbType.AnsiString, model.DemandArea);
			db.AddInParameter(dbCommand, "ServiceDemand", DbType.AnsiString, model.ServiceDemand);
			db.AddInParameter(dbCommand, "HouseBuyTime", DbType.AnsiString, model.HouseBuyTime);
			db.AddInParameter(dbCommand, "DemandBuilding", DbType.AnsiString, model.DemandBuilding);
			db.AddInParameter(dbCommand, "SpecialDemand", DbType.AnsiString, model.SpecialDemand);
			db.AddInParameter(dbCommand, "DemandStyle_Room", DbType.Int32, model.DemandStyle_Room);
			db.AddInParameter(dbCommand, "DemandStyle_Hall", DbType.Int32, model.DemandStyle_Hall);
			db.AddInParameter(dbCommand, "DemandStyle_Toilet", DbType.Int32, model.DemandStyle_Toilet);
			db.AddInParameter(dbCommand, "UnitPrice", DbType.AnsiString, model.UnitPrice);
			db.AddInParameter(dbCommand, "CompanyId", DbType.Guid, model.CompanyId);
			db.AddInParameter(dbCommand, "CompanyName", DbType.AnsiString, model.CompanyName);
			db.AddInParameter(dbCommand, "Fitment", DbType.AnsiString, model.Fitment);
			db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
			db.AddInParameter(dbCommand, "ServiceNum", DbType.Int32, model.ServiceNum);
			db.AddInParameter(dbCommand, "Catalog", DbType.AnsiString, model.Catalog);
			db.AddInParameter(dbCommand, "ReturnRate", DbType.AnsiString, model.ReturnRate);
			db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
			db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
			db.AddInParameter(dbCommand, "Updatetime", DbType.DateTime, model.Updatetime);
			db.AddInParameter(dbCommand, "AddPersonId", DbType.Guid, model.AddPersonId);
			db.AddInParameter(dbCommand, "AddPerson", DbType.AnsiString, model.AddPerson);
			db.AddInParameter(dbCommand, "AddDepartId", DbType.Guid, model.AddDepartId);
			db.AddInParameter(dbCommand, "AddDepart", DbType.AnsiString, model.AddDepart);
			db.AddInParameter(dbCommand, "OprPersonId", DbType.Guid, model.OprPersonId);
			db.AddInParameter(dbCommand, "OprPerson", DbType.AnsiString, model.OprPerson);
			db.AddInParameter(dbCommand, "OprDepartId", DbType.Guid, model.OprDepartId);
			db.AddInParameter(dbCommand, "OprDepart", DbType.AnsiString, model.OprDepart);
			db.AddInParameter(dbCommand, "LastTraceDay", DbType.DateTime, model.LastTraceDay);
			db.AddInParameter(dbCommand, "Filter", DbType.AnsiString, model.Filter);
            db.AddInParameter(dbCommand, "PubLevel", DbType.Int32, model.PubLevel);

			db.ExecuteNonQuery(dbCommand);
		}
		/// <summary>
		/// 更新一条数据
		/// </summary>
        public static void Update(Chenxin.Lib.House.Entity.Customer_DemandInfo model)
		{
			StringBuilder strSql=new StringBuilder();
			strSql.Append("update Customer_DemandInfo set ");
			strSql.Append("CustomerId=@CustomerId,");
			strSql.Append("CustomerCode=@CustomerCode,");
			strSql.Append("CustomerName=@CustomerName,");
			strSql.Append("DemandKind=@DemandKind,");
			strSql.Append("DemandType=@DemandType,");
			strSql.Append("DemandZone=@DemandZone,");
			strSql.Append("TotalPrice=@TotalPrice,");
			strSql.Append("HouseUse=@HouseUse,");
			strSql.Append("Consider=@Consider,");
            strSql.Append("CityId=@CityId,");
            strSql.Append("CityName=@CityName,");
			strSql.Append("DemandArea=@DemandArea,");
			strSql.Append("ServiceDemand=@ServiceDemand,");
			strSql.Append("HouseBuyTime=@HouseBuyTime,");
			strSql.Append("DemandBuilding=@DemandBuilding,");
			strSql.Append("SpecialDemand=@SpecialDemand,");
			strSql.Append("DemandStyle_Room=@DemandStyle_Room,");
			strSql.Append("DemandStyle_Hall=@DemandStyle_Hall,");
			strSql.Append("DemandStyle_Toilet=@DemandStyle_Toilet,");
			strSql.Append("UnitPrice=@UnitPrice,");
			strSql.Append("CompanyId=@CompanyId,");
			strSql.Append("CompanyName=@CompanyName,");
			strSql.Append("Fitment=@Fitment,");
			strSql.Append("Remark=@Remark,");
			strSql.Append("ServiceNum=@ServiceNum,");
			strSql.Append("Catalog=@Catalog,");
			strSql.Append("ReturnRate=@ReturnRate,");
			strSql.Append("Status=@Status,");
			strSql.Append("Addtime=@Addtime,");
			strSql.Append("Updatetime=@Updatetime,");
			strSql.Append("AddPersonId=@AddPersonId,");
			strSql.Append("AddPerson=@AddPerson,");
			strSql.Append("AddDepartId=@AddDepartId,");
			strSql.Append("AddDepart=@AddDepart,");
			strSql.Append("OprPersonId=@OprPersonId,");
			strSql.Append("OprPerson=@OprPerson,");
			strSql.Append("OprDepartId=@OprDepartId,");
			strSql.Append("OprDepart=@OprDepart,");
			strSql.Append("LastTraceDay=@LastTraceDay,");
			strSql.Append("Filter=@Filter,");
            strSql.Append("PubLevel=@PubLevel");
			strSql.Append(" where DemandId=@DemandId ");
			Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING);
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "DemandId", DbType.Guid, model.DemandId);
			db.AddInParameter(dbCommand, "CustomerId", DbType.Guid, model.CustomerId);
			db.AddInParameter(dbCommand, "CustomerCode", DbType.AnsiString, model.CustomerCode);
			db.AddInParameter(dbCommand, "CustomerName", DbType.AnsiString, model.CustomerName);
			db.AddInParameter(dbCommand, "DemandKind", DbType.Int32, model.DemandKind);
			db.AddInParameter(dbCommand, "DemandType", DbType.Int32, model.DemandType);
			db.AddInParameter(dbCommand, "DemandZone", DbType.AnsiString, model.DemandZone);
			db.AddInParameter(dbCommand, "TotalPrice", DbType.AnsiString, model.TotalPrice);
			db.AddInParameter(dbCommand, "HouseUse", DbType.AnsiString, model.HouseUse);
			db.AddInParameter(dbCommand, "Consider", DbType.AnsiString, model.Consider);
			db.AddInParameter(dbCommand, "DemandArea", DbType.AnsiString, model.DemandArea);
			db.AddInParameter(dbCommand, "ServiceDemand", DbType.AnsiString, model.ServiceDemand);
			db.AddInParameter(dbCommand, "HouseBuyTime", DbType.AnsiString, model.HouseBuyTime);
			db.AddInParameter(dbCommand, "DemandBuilding", DbType.AnsiString, model.DemandBuilding);
			db.AddInParameter(dbCommand, "SpecialDemand", DbType.AnsiString, model.SpecialDemand);
			db.AddInParameter(dbCommand, "DemandStyle_Room", DbType.Int32, model.DemandStyle_Room);
			db.AddInParameter(dbCommand, "DemandStyle_Hall", DbType.Int32, model.DemandStyle_Hall);
			db.AddInParameter(dbCommand, "DemandStyle_Toilet", DbType.Int32, model.DemandStyle_Toilet);
			db.AddInParameter(dbCommand, "UnitPrice", DbType.AnsiString, model.UnitPrice);
			db.AddInParameter(dbCommand, "CompanyId", DbType.Guid, model.CompanyId);
			db.AddInParameter(dbCommand, "CompanyName", DbType.AnsiString, model.CompanyName);
			db.AddInParameter(dbCommand, "Fitment", DbType.AnsiString, model.Fitment);
			db.AddInParameter(dbCommand, "Remark", DbType.AnsiString, model.Remark);
            db.AddInParameter(dbCommand, "CityId", DbType.Guid, model.CityId);
            db.AddInParameter(dbCommand, "CityName", DbType.AnsiString, model.CityName);
			db.AddInParameter(dbCommand, "ServiceNum", DbType.Int32, model.ServiceNum);
			db.AddInParameter(dbCommand, "Catalog", DbType.AnsiString, model.Catalog);
			db.AddInParameter(dbCommand, "ReturnRate", DbType.AnsiString, model.ReturnRate);
			db.AddInParameter(dbCommand, "Status", DbType.Int32, model.Status);
			db.AddInParameter(dbCommand, "Addtime", DbType.DateTime, model.Addtime);
			db.AddInParameter(dbCommand, "Updatetime", DbType.DateTime, model.Updatetime);
			db.AddInParameter(dbCommand, "AddPersonId", DbType.Guid, model.AddPersonId);
			db.AddInParameter(dbCommand, "AddPerson", DbType.AnsiString, model.AddPerson);
			db.AddInParameter(dbCommand, "AddDepartId", DbType.Guid, model.AddDepartId);
			db.AddInParameter(dbCommand, "AddDepart", DbType.AnsiString, model.AddDepart);
			db.AddInParameter(dbCommand, "OprPersonId", DbType.Guid, model.OprPersonId);
			db.AddInParameter(dbCommand, "OprPerson", DbType.AnsiString, model.OprPerson);
			db.AddInParameter(dbCommand, "OprDepartId", DbType.Guid, model.OprDepartId);
			db.AddInParameter(dbCommand, "OprDepart", DbType.AnsiString, model.OprDepart);
			db.AddInParameter(dbCommand, "LastTraceDay", DbType.DateTime, model.LastTraceDay);
			db.AddInParameter(dbCommand, "Filter", DbType.AnsiString, model.Filter);
            db.AddInParameter(dbCommand, "PubLevel", DbType.Int32, model.PubLevel);
			db.ExecuteNonQuery(dbCommand);

		}

		/// <summary>
		/// 删除一条数据
		/// </summary>
        public static void Delete(Guid DemandId)
		{
			
			StringBuilder strSql=new StringBuilder();
			strSql.Append("delete from Customer_DemandInfo ");
			strSql.Append(" where DemandId=@DemandId ");
			Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING);
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "DemandId", DbType.Guid,DemandId);
			db.ExecuteNonQuery(dbCommand);

		}

		/// <summary>
		/// 得到一个对象实体
		/// </summary>
        public static Chenxin.Lib.House.Entity.Customer_DemandInfo GetModel(Guid DemandId)
		{
			
			StringBuilder strSql=new StringBuilder();
            strSql.Append("select CityId,CityName,DemandId,CustomerId,CustomerCode,CustomerName,DemandKind,DemandType,DemandZone,TotalPrice,HouseUse,Consider,DemandArea,ServiceDemand,HouseBuyTime,DemandBuilding,SpecialDemand,DemandStyle_Room,DemandStyle_Hall,DemandStyle_Toilet,UnitPrice,CompanyId,CompanyName,Fitment,Remark,ServiceNum,Catalog,ReturnRate,Status,Addtime,Updatetime,AddPersonId,AddPerson,AddDepartId,AddDepart,OprPersonId,OprPerson,OprDepartId,OprDepart,LastTraceDay,Filter,PubLevel from Customer_DemandInfo ");
			strSql.Append(" where DemandId=@DemandId ");
            Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING_SEARCH);
			DbCommand dbCommand = db.GetSqlStringCommand(strSql.ToString());
			db.AddInParameter(dbCommand, "DemandId", DbType.Guid,DemandId);
			Chenxin.Lib.House.Entity.Customer_DemandInfo model=null;
			using (IDataReader dataReader = db.ExecuteReader(dbCommand))
			{
				if(dataReader.Read())
				{
					model=ReaderBind(dataReader);
				}
                dataReader.Close();
                dataReader.Dispose();
			}
			return model;
		}

		/// <summary>
		/// 获得数据列表
		/// </summary>
        public static DataSet GetList(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
            strSql.Append("select CityId,CityName,DemandId,CustomerId,CustomerCode,CustomerName,DemandKind,DemandType,DemandZone,TotalPrice,HouseUse,Consider,DemandArea,ServiceDemand,HouseBuyTime,DemandBuilding,SpecialDemand,DemandStyle_Room,DemandStyle_Hall,DemandStyle_Toilet,UnitPrice,CompanyId,CompanyName,Fitment,Remark,ServiceNum,Catalog,ReturnRate,Status,Addtime,Updatetime,AddPersonId,AddPerson,AddDepartId,AddDepart,OprPersonId,OprPerson,OprDepartId,OprDepart,LastTraceDay,Filter,PubLevel ");
			strSql.Append(" FROM Customer_DemandInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
            Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING_SEARCH);
			return db.ExecuteDataSet(CommandType.Text, strSql.ToString());
		}

        /// <summary>
        /// 分页获取数据列表
        /// </summary>
        public static DataSet GetList(int PageIndex, int PageSize, String OrderField, string TableName, string StrWhere, string FieldList, string TableFieldList, bool DoCount)
        {
            Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING_SEARCH);
            DbCommand dbCommand = db.GetStoredProcCommand("PagerMultiTable");
            db.AddInParameter(dbCommand, "PageIndex", DbType.Int32, PageIndex);
            db.AddInParameter(dbCommand, "PageSize", DbType.Int32, PageSize);
            db.AddInParameter(dbCommand, "OrderField", DbType.AnsiString, OrderField);
            db.AddInParameter(dbCommand, "TableName", DbType.AnsiString, TableName);
            db.AddInParameter(dbCommand, "StrWhere", DbType.AnsiString, StrWhere);
            db.AddInParameter(dbCommand, "FieldList", DbType.AnsiString, FieldList);
            db.AddInParameter(dbCommand, "TableFieldList", DbType.AnsiString, TableFieldList);
            db.AddInParameter(dbCommand, "DoCount", DbType.Boolean, DoCount);
            return db.ExecuteDataSet(dbCommand);
        }

		/// <summary>
		/// 获得数据列表（比DataSet效率高，推荐使用）
		/// </summary>
		public  static List<Chenxin.Lib.House.Entity.Customer_DemandInfo> GetListArray(string strWhere)
		{
			StringBuilder strSql=new StringBuilder();
            strSql.Append("select CityId,CityName,DemandId,CustomerId,CustomerCode,CustomerName,DemandKind,DemandType,DemandZone,TotalPrice,HouseUse,Consider,DemandArea,ServiceDemand,HouseBuyTime,DemandBuilding,SpecialDemand,DemandStyle_Room,DemandStyle_Hall,DemandStyle_Toilet,UnitPrice,CompanyId,CompanyName,Fitment,Remark,ServiceNum,Catalog,ReturnRate,Status,Addtime,Updatetime,AddPersonId,AddPerson,AddDepartId,AddDepart,OprPersonId,OprPerson,OprDepartId,OprDepart,LastTraceDay,Filter,PubLevel ");
			strSql.Append(" FROM Customer_DemandInfo ");
			if(strWhere.Trim()!="")
			{
				strSql.Append(" where "+strWhere);
			}
			List<Chenxin.Lib.House.Entity.Customer_DemandInfo> list = new List<Chenxin.Lib.House.Entity.Customer_DemandInfo>();
            Database db = DatabaseFactory.CreateDatabase(CONNECTSTRING_SEARCH);
			using (IDataReader dataReader = db.ExecuteReader(CommandType.Text, strSql.ToString()))
			{
				while (dataReader.Read())
				{
					list.Add(ReaderBind(dataReader));
				}
                dataReader.Close();
                dataReader.Dispose();
			}
			return list;
		}


		/// <summary>
		/// 对象实体绑定数据
		/// </summary>
		public  static Chenxin.Lib.House.Entity.Customer_DemandInfo ReaderBind(IDataReader dataReader)
		{
			Chenxin.Lib.House.Entity.Customer_DemandInfo model=new Chenxin.Lib.House.Entity.Customer_DemandInfo();
			object ojb; 
			ojb = dataReader["DemandId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.DemandId= new Guid(ojb.ToString());
			}
			ojb = dataReader["CustomerId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.CustomerId= new Guid(ojb.ToString());
			}
			model.CustomerCode=dataReader["CustomerCode"].ToString();
			model.CustomerName=dataReader["CustomerName"].ToString();
			ojb = dataReader["DemandKind"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.DemandKind=(int)ojb;
			}
			ojb = dataReader["DemandType"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.DemandType=(int)ojb;
			}
			model.DemandZone=dataReader["DemandZone"].ToString();
			model.TotalPrice=dataReader["TotalPrice"].ToString();
			model.HouseUse=dataReader["HouseUse"].ToString();
			model.Consider=dataReader["Consider"].ToString();
			model.DemandArea=dataReader["DemandArea"].ToString();
			model.ServiceDemand=dataReader["ServiceDemand"].ToString();
			model.HouseBuyTime=dataReader["HouseBuyTime"].ToString();
			model.DemandBuilding=dataReader["DemandBuilding"].ToString();
			model.SpecialDemand=dataReader["SpecialDemand"].ToString();
			ojb = dataReader["DemandStyle_Room"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.DemandStyle_Room=(int)ojb;
			}
			ojb = dataReader["DemandStyle_Hall"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.DemandStyle_Hall=(int)ojb;
			}
			ojb = dataReader["DemandStyle_Toilet"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.DemandStyle_Toilet=(int)ojb;
			}
			model.UnitPrice=dataReader["UnitPrice"].ToString();
			ojb = dataReader["CompanyId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.CompanyId= new Guid(ojb.ToString());
			}
			model.CompanyName=dataReader["CompanyName"].ToString();
			model.Fitment=dataReader["Fitment"].ToString();
			model.Remark=dataReader["Remark"].ToString();
			ojb = dataReader["ServiceNum"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.ServiceNum=(int)ojb;
			}
			model.Catalog=dataReader["Catalog"].ToString();
			model.ReturnRate=dataReader["ReturnRate"].ToString();
			ojb = dataReader["Status"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.Status=(int)ojb;
			}
			ojb = dataReader["Addtime"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.Addtime=(DateTime)ojb;
			}
			ojb = dataReader["Updatetime"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.Updatetime=(DateTime)ojb;
			}
			ojb = dataReader["AddPersonId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.AddPersonId= new Guid(ojb.ToString());
			}
			model.AddPerson=dataReader["AddPerson"].ToString();
			ojb = dataReader["AddDepartId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.AddDepartId= new Guid(ojb.ToString());
			}
			model.AddDepart=dataReader["AddDepart"].ToString();
			ojb = dataReader["OprPersonId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.OprPersonId= new Guid(ojb.ToString());
			}
			model.OprPerson=dataReader["OprPerson"].ToString();
			ojb = dataReader["OprDepartId"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.OprDepartId= new Guid(ojb.ToString());
			}
			model.OprDepart=dataReader["OprDepart"].ToString();
			ojb = dataReader["LastTraceDay"];
			if(ojb != null && ojb != DBNull.Value)
			{
				model.LastTraceDay=(DateTime)ojb;
			}
			model.Filter=dataReader["Filter"].ToString();
            ojb = dataReader["CityId"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.CityId = new Guid(ojb.ToString());
            }
            model.CityName = dataReader["CityName"].ToString();
            ojb = dataReader["PubLevel"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.PubLevel = (int)ojb;
            }
			return model;
		}

		#endregion  成员方法
	}
}
